import { ApiProperty } from '@nestjs/swagger';
import { IsEnum, IsNumber, IsOptional, IsString, Min } from 'class-validator';
import { Type } from 'class-transformer';

export enum VideoStatusFilter {
  ALL = 'all',
  PENDING = 'pending',
  APPROVED = 'approved',
  REJECTED = 'rejected',
  HIDDEN = 'hidden',
}

export class GetUserVideosDto {
  @ApiProperty({
    description: '页码',
    example: 1,
    required: false,
    default: 1,
  })
  @IsOptional()
  @Type(() => Number)
  @IsNumber()
  @Min(1)
  page: number = 1;

  @ApiProperty({
    description: '每页条数',
    example: 10,
    required: false,
    default: 10,
  })
  @IsOptional()
  @Type(() => Number)
  @IsNumber()
  @Min(1)
  limit: number = 10;

  @ApiProperty({
    description: '视频状态筛选',
    enum: VideoStatusFilter,
    example: VideoStatusFilter.ALL,
    required: false,
    default: VideoStatusFilter.ALL,
  })
  @IsOptional()
  @IsEnum(VideoStatusFilter)
  status: VideoStatusFilter = VideoStatusFilter.ALL;

  @ApiProperty({
    description: '搜索关键词（搜索标题或分类名称）',
    example: '旅游',
    required: false,
  })
  @IsOptional()
  @IsString()
  keyword?: string;
}